home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / windlg.zip / WINDLG.TXT < prev   
Text File  |  1993-04-17  |  2KB  |  40 lines

  1. This is a simple example of how to do a PM app with a 
  2. dialog box as its main window. 
  3.  
  4. There's not much to explain, except maybe the MSGMAP_BEGIN
  5. stuff at the top of the file. MSGMAP_* and CMDMAP_* are
  6. macros #defined in msgmap.h, which i usually use to eliminate
  7. the huge, clumsy switch statements in the window proc. Since
  8. the use of this method makes the window proc a real simple
  9. function, i decided to put it in a macro, and eliminate it from
  10. the code, or at least give the appearance of it not being there.
  11.  
  12. the parameter you pass to MSGMAP_BEGIN is the name of the
  13. MSGMAP variable that will be used.(for more info, see msgmap.h)
  14. the parameters you pass to MSGMAP_END are the name of the MSGMAP
  15. variable mentioned above, the address of the window proc for this
  16. MSGMAP, and the name of the subclassed window proc. This allows you
  17. to have more than one MSGMAP, so you can subclass windows, etc.
  18.  
  19. the CMDMAP_BEGIN macro takes the name of another MSGMAP variable.
  20. the CMDMAP_END macro takes the name of the MSGMAP variable, and
  21. the address of the command proc, or (usually) the function that 
  22. handles WM_COMMAND messages. this could probably be used to handle
  23. WM_SYSCOMMAND messages too, but i haven't messed with it, so i don't
  24. know.
  25.  
  26. note that when using this method, you MUST prototype every
  27. function mentioned in the MSGMAP_* and CMDMAP_* sections(with
  28. the exception of the ones prototyped in msgmap.h), or the 
  29. compiler will crap out with lots of error messages. 
  30.  
  31. Thanks to Bill Leonard, and Joerg Reimers, for showing
  32. me how to get the dialog box part to work.
  33.  
  34. you're free to use this code as you like.
  35.  
  36. Enjoy it,
  37.  
  38. Kelly Schrock
  39.  
  40. CIS id: 70572,1247